/*
 * @Description: 
 * @Author: 阳婷
 * @Date: 2021-03-17 09:41:03
 * @LastEditTime: 2022-03-21 09:28:33
 * @LastEditors: 阳婷
 */
// 获取Cookie等方法封装 统一维护

import Cookies from 'js-cookie'
// import md5 from 'js-md5';
let Base64 = require('js-base64').Base64;

const TokenKey = 'Admin-Token-autoSale'
const TokenKeys = 'Admin-Tokens-autoSale'
const UsernameKey = 'U-autoSale'
const Password = 'P-autoSale'
const Checked = 'O-autoSale'
const Avatar = 'A-autoSale'
const Member = 'M-autoSale'
const MemberId = 'I-autoSale'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getTokens() {
  return Cookies.get(TokenKeys)
}
export function removeTokens() {
  return Cookies.remove(TokenKeys)
}
export function setTokens(token) {
  return Cookies.set(TokenKeys, token)
}

export function getUsername() {
  return Base64.decode(Cookies.get(UsernameKey))
}

export function setUsername(token) {
  return Cookies.set(UsernameKey, Base64.encode(token))
}

export function getPassword() {
  return Base64.decode(Cookies.get(Password))
}

export function setPassword(token) {
  return Cookies.set(Password, Base64.encode(token))
}

export function getChecked() {
  return Cookies.get(Checked)
}

export function setChecked(token) {
  return Cookies.set(Checked, token)
}

export function getAvatar() {
  return Cookies.get(Avatar)
}

export function setAvatar(token) {
  return Cookies.set(Avatar, token)
}

export function getMember() {
  return Cookies.get(Member)
}

export function setMember(token) {
  return Cookies.set(Member, token)
}
export function getMemberId() {
  return Cookies.get(MemberId)
}

export function setMemberId(token) {
  return Cookies.set(MemberId, token)
}